<!-- 安全中心 -->
<template>
	<view class="manage-page">
		<view class="root-wrap">
			<!-- 修改密码 -->
			<navigator class="mine-item" 
			url="/pages/resetting-pass/resetting-pass" open-type="navigate"  >
				<view style="display: flex;align-items: center;">
					<text style="font-size: 30rpx;margin-left: 20rpx;">修改密码</text>
				</view>
				<van-icon name="arrow" />
			</navigator>
			<!-- 账号注销 -->
			<view class="root" @click="upuser">
				<view style="display: flex;align-items: center;">
					<text style="font-size: 30rpx;margin-left: 20rpx;">账号注销</text>
				</view>
				<van-icon name="arrow" />
			</view>
		</view>
	</view>
</template>

<script setup>
import {ref} from 'vue'
import {useStore} from 'vuex'
import api from './../../lib/request.js'

const store = useStore()
let id =ref(store.state.uid)

// 注销账号
function upuser(){
	console.log('111');
	api.del(`/user/deleteUser/${id.value}`).then(res=>{
		console.log(res);
		if(res.code){
			uni.showToast({
				title: '注销成功',
				icon: 'none',
				success: () => {
					uni.setStorageSync('token','')
					store.commit('update_uid','')
					store.commit('update_name','')
					store.commit('update_home','')
				}
				})
			
		}
	})
}
</script>

<style>

	/*其它 */
	.root-wrap{
		height: 900rpx;
		/* height: calc(100vh - 300px); */
		background-color: #fff;
		margin-top: 20rpx;
	}
	.mine-page {
		/* background-color: bisque; */
		height: calc(100vh - 94px);
		padding-top: 10px;
		box-sizing: border-box;
	}
	
	.info-wrap {
		padding: 20px;
		background-color: #F8F8F8;
		display: flex;
	
	}
	
	.info-wrap>image {
		width: 160rpx;
		height: 160rpx;
	}
	
	.info-wrap>text {
		font-size: 44rpx;
		font-weight: bold;
		margin-left: 20px;
		margin-top: 10px;
	}
	.mine-item{
		display: flex;
		justify-content: space-between;
		padding: 30rpx 20rpx;
		border-bottom: 1px solid rgb(245, 245, 245);
	}
	/* 更换密码 */
	.mine-page {
		height: calc(100vh - 94px);
		padding-top: 10px;
		box-sizing: border-box;
	}
	
	.root{
		display: flex;
		justify-content: space-between;
		padding: 30rpx 20rpx;
		border-bottom: 1px solid rgb(245, 245, 245);
		width: 700rpx;
		margin: auto;
	}
</style>
